<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<html>
<head>
<script type="text/javascript">
	$(function() {
		$('input').checkBox();
		$('#toggle-all').click(function() {
			$('#toggle-all').toggleClass('toggle-checked');
			$('#mainform input[type=checkbox]').checkBox('toggle');
			return false;
		});
	});
</script>

<!--  styled select box script version 2 -->

<script type="text/javascript">
	$(document).ready(function() {
		$('.styledselect_form_1').selectbox({
			inputClass : "styledselect_form_1"
		});
		$('.styledselect_form_2').selectbox({
			inputClass : "styledselect_form_2"
		});
	});
</script>

<!--  styled file upload script -->

<script type="text/javascript" charset="utf-8">
	$(function() {
		$("input.file_1").filestyle({
			image : "<spring:theme code='theme.admin'/>/imageForms/upload_file.gif",
			imageheight : 29,
			imagewidth : 78,
			width : 300
		});
	});
</script>

<!--end form -->
<title>Thêm Banner</title>
</head>
<body>
	<div id="page-heading">
		<h1>Thêm Banner</h1>
	</div>
	<form:form action="save-banner" commandName="bannerVO" method="post" enctype="multipart/form-data">
		<!-- start id-form -->
		<form:hidden path="id"/>
		<form:hidden path="nameFile"/>
		<form:hidden path="createDate"/>
		<form:hidden path="urlFile"/>
		<form:hidden path="active" value="true"/>
		<table border="0" cellpadding="0" cellspacing="0" id="id-form">
			<tr>
				<th valign="top">Loại:</th>
				<td>
				<form:radiobutton path="type" value="BANNER" class=".inp-form-radio" /><label>banner</label> 
				<form:radiobutton path="type" value="ADVERTISING" class=".inp-form-radio" /><label>quảng cáo</label>
				<%-- <form:select path="active" class="styledselect_form_1">
						<option value="0">Không hiển thị</option>
						<option value="1">Hiển thị</option>
				</form:select> --%>
				</td>
				<td><form:errors path="type" class="error" /></td>
			</tr>
			<tr>
				<th>Upload banner:</th>
				<td style="width: 390px;"><form:input type="file" path="fileBannerUpload" class="file_1" /></td>
				<td>
					<div class="bubble-left"></div>
					<div class="bubble-inner">JPG,PNG,JPEG,GIF. Tối đa là 2MB</div>
					<div class="bubble-right"></div>
				</td>
			</tr>
			<c:if test="${hasErrorUploadBanner }">
				<tr>
					<th></th>
					<td><span class="error">${errorUploadBanner }</span></td>
				</tr>
			</c:if>
			<tr>
				<th>&nbsp;</th>
				<td valign="top"><input type="submit" value="Lưu" class="form-submit" />
					<input type="reset" value="Hủy" class="form-reset" onclick="window.location.href='banner-info'"/></td>
				<td></td>
			</tr>
		</table>
	</form:form>
	<script type="text/javascript">
		$(document).ready(function(){
			var isAddSuccessful = '${addStatus}';
			if(isAddSuccessful == 'true'){
				var message = "<p style='font-size: 12px;'>Lưu thành công! </p>";		
				jNotify(message,{
				     autoHide : true, 
				     TimeShown : 3000,
				     HorizontalPosition : 'center',
				     onCompleted : function(){
				    	 window.location.href = "banner-info";   
					 }
				   }
				 );	
			}
		});
	</script>
</body>
</html>